package com.sunb2b.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.validation.constraints.Past;
import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.DateTimeFormat.ISO;

public class Member {

    // Fields

    private Integer id;
    @Length(min=3, max=20, message="长度必须在3-20之间")
    private String name;
    @Length(min=3, max=20, message="长度必须在3-20之间")
    private String username;
    @Length(min=6, max=20, message="长度必须在6-20之间")
    private String password;
    @Length(min=6, max=20, message="长度必须在6-20之间")
    private String password1;
    
    @DateTimeFormat(iso=ISO.DATE)
	@Past
    private Date regDate;
    @Email(message="Email不合法")
    private String email;
    
    private Region region;
    @Length(max=30, message="长度不合法")
    private String regionId;
    @Length(max=20, message="长度不合法")
    private String memberType;
    @NotEmpty
    @Pattern(regexp = "[0-9\\-\\(\\)]{3,20}", message="不是合法的电话号码")
    private String tel;
    @Pattern(regexp = "[0-9\\-\\(\\)]{0,20}", message="不是合法的电话号码")
    private String fax;
    @Length(max=6, message="邮编最长6位")
    private String postCode;
    @Length(min=3, max=100, message="地址长度必须在3到100之间")
    private String address;
    @Pattern(regexp = "[0-9\\-\\(\\)]{0,20}", message="不是合法的电话号码")
    private String mobile;
    
    private String description;
    
    private String status;
    //@NotEmpty(message="不能为空")
    private String validCode;
    
    private Set products = new HashSet(0);

    // Constructors

    /** default constructor */
    public Member() {
    }

    /** minimal constructor */
    public Member(String name, String username, String password, String email,
            String tel, String address) {
        this.name = name;
        this.username = username;
        this.password = password;
        this.email = email;
        this.tel = tel;
        this.address = address;
    }

    /** full constructor */
    public Member(String name, String username, String password,
            Date regDate, String email, Region region,
            String memberType, String tel, String fax, String postCode,
            String address, String mobile, String description, String status,
            Set products) {
        this.name = name;
        this.username = username;
        this.password = password;
        this.regDate = regDate;
        this.email = email;
        this.region = region;
        this.memberType = memberType;
        this.tel = tel;
        this.fax = fax;
        this.postCode = postCode;
        this.address = address;
        this.mobile = mobile;
        this.description = description;
        this.status = status;
        this.products = products;
    }

    // Property accessors

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }
    
    public String getValidCode() {
		return validCode;
	}

	public void setValidCode(String validCode) {
		this.validCode = validCode;
	}

	public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUsername() {
        return this.username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return this.password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Date getRegDate() {
        return this.regDate;
    }

    public void setRegDate(Date regDate) {
        this.regDate = regDate;
    }

    public String getEmail() {
        return this.email;
    }

    public void setEmail(String email) {
        this.email = email;
    }


    public Region getRegion() {
        return region;
    }

    public void setRegion(Region region) {
        this.region = region;
    }

    public String getMemberType() {
        return this.memberType;
    }

    public void setMemberType(String memberType) {
        this.memberType = memberType;
    }

    public String getTel() {
        return this.tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    public String getFax() {
        return this.fax;
    }

    public void setFax(String fax) {
        this.fax = fax;
    }

    public String getPostCode() {
        return this.postCode;
    }

    public void setPostCode(String postCode) {
        this.postCode = postCode;
    }

    public String getAddress() {
        return this.address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getMobile() {
        return this.mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getDescription() {
        return this.description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getStatus() {
        return this.status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Set getProducts() {
        return this.products;
    }

    public void setProducts(Set products) {
        this.products = products;
    }

    public String getRegionId() {
        return regionId;
    }

    public void setRegionId(String regionId) {
        this.regionId = regionId;
    }

	public String getPassword1() {
		return password1;
	}

	public void setPassword1(String password1) {
		this.password1 = password1;
	}

}